// 简单的国际化工具
const messages = {
  'zh-CN': {
    'btn.all_years': '所有年份',
    'btn.sort': '排序',
    'btn.filter': '筛选',
    'btn.read': '阅读',
    'text.all': '全部'
  },
  'en-US': {
    'btn.all_years': 'All Years',
    'btn.sort': 'Sort',
    'btn.filter': 'Filter',
    'btn.read': 'Read',
    'text.all': 'All'
  }
}

let currentLocale = 'zh-CN'

export function t(key: string): string {
  const localeMessages = messages[currentLocale as keyof typeof messages]
  return localeMessages?.[key as keyof typeof localeMessages] || key
}

export function setLocale(locale: string) {
  if (locale in messages) {
    currentLocale = locale
  }
}

export function useI18n() {
  return {
    t,
    setLocale
  }
}
